package com.xzlf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xzlf.mapper.TbUserMapper;
import com.xzlf.entity.TbUser;
import com.xzlf.service.TbUserService;
@Service
public class TbUserServiceImpl extends ServiceImpl<TbUserMapper, TbUser> implements TbUserService{

    @Override
    public int updateBatch(List<TbUser> list) {
        return baseMapper.updateBatch(list);
    }
    @Override
    public int updateBatchSelective(List<TbUser> list) {
        return baseMapper.updateBatchSelective(list);
    }
    @Override
    public int batchInsert(List<TbUser> list) {
        return baseMapper.batchInsert(list);
    }

    @Override
    public Page<TbUser> page(Long current, Long size, String username) {
        Page<TbUser> tbUserPage = new Page<>(current, size);
        Page<TbUser> page = page(tbUserPage, new LambdaQueryWrapper<TbUser>()
                .likeRight(StringUtils.isNotBlank(username), TbUser::getUsername, username));
        System.out.println(page.getTotal());
        return page;
    }
}
